# Project: DataStructure
# Makefile created by xuehao(www.stickmind.com)

CC      = gcc
CFLAGS  = -g3 -O0 -std=gnu99 -Wall $$warnflags -I $(INCLUDE)
LDFLAGS = -L $(LIBRARY)
LDLIBS  = -lds

CFILES  = $(wildcard *.c $(SRC)/*.c)
OBJECT  = $(CFILES:.c=.o)

PROGRAM = main
OUTPUT  = libds.a
INCLUDE = include
LIBRARY = lib
SRC     = src

.PHONY: all
all: scratch install $(PROGRAM)

.PHONY: install
install: $(OUTPUT)
	mkdir -p $(LIBRARY)
	mv $(OUTPUT) $(LIBRARY)

$(OUTPUT): $(OBJECT)
	ar ru $@ $^
	ranlib $@

.PHONY: clean
clean:
	rm -f $(OBJECT) $(PROGRAM)

.PHONY: scratch
scratch: clean
	rm -r $(LIBRARY)
